A little introduction to my project

The idea for this project came from a conversation I had just a few months back. I was catching-up with an old roommate of mine who has since found himself exploring the world of real estate. He was explaining to me how his research has led him to focus his attention on student rental properties, just like the one we used to live in together. As a poor college student myself, the idea of generating some passive income is more than enticing. It was very soon in the conversation, however, that I realized his method of finding properties to rent was fairly inefficient. The thought then came to me: if my friend can have so much success with his current strategy to find properties, surely I could have the same success by developing an even better strategy! Thus, I set-out to find my next student rental property and here’s what I found…

Planning

First, I wanted to narrow down the search of properties to those which are located near university campuses that will consistently have the greatest amount of students looking for a place to live.
To do this, I searched the web for the universities with the greatest undergraduate population. I scraped (using rvest) this wikipedia page that had a neatly kept list of the Top 10 Most Populous Universities and their undergraduate populations from 2009 to present.

Here’s a look at the first 10 rows:

year_start year_finish campus city state pop
2020 2021 Texas A&M University College Station Texas 73284
2020 2021 University of Central Florida Orlando Florida 70406
2020 2021 Ohio State University Columbus Ohio 67772
2020 2021 University of Florida Gainesville Florida 60613
2020 2021 Florida International University Miami Florida 56627
2020 2021 University of Illinois at Urbana–Champaign Urbana/Champaign Illinois 56299
2020 2021 Arizona State University Tempe Arizona 54000
2020 2021 Georgia State University Atlanta Georgia 52530
2020 2021 University of Minnesota Minneapolis/Saint Paul Minnesota 52376
2020 2021 University of Texas at Austin Austin Texas 51992

And here’s a look at each campus on the Wikipedia page through the years:
Note that some campuses made the list only a few times, whereas others were on the list every year.

Finally, here is a list of the schools that were in the Top 10 Most Populous Universities for over ten years and the number of years they were on it. These schools consistently had the greatest amount of students looking for a place to live.

campus num
Arizona State University 12
Ohio State University 12
Texas A&M University 12
University of Central Florida 12
University of Florida 12
University of Minnesota 12
Florida International University 11
University of Texas at Austin 11

But, wait…

What if these universities house the majority of their students on campus? To account for this, I had to do a little more digging. I visited a variety of sources to determine what percent of students typically live on-campus vs off-campus at each of the previously mentioned universities, and then compiled a list. Here’s a look at those percentages:

campus on off
Texas A&M University 20 80
University of Central Florida 15 85
Ohio State University 24 76
University of Florida 16 84
Florida International University 5 95
University of Illinois at Urbana–Champaign 50 50
Arizona State University 19 81
Georgia State University 15 85
University of Minnesota 13 87
University of Texas at Austin 8 92
University of South Florida 10 90
Michigan State University 6 94
Indiana University 27 73
Pennsylvania State University 26 74
Indiana University Bloomington 27 73

I then used these percentages to estimate the amount of the undergraduate students that will be looking for off-campus housing at each of these universities:
Note: although Texas A&M has a higher student population overall, the University of Central Florida most likely has more students in search of off-campus housing (and, hopefully, my rental property!)

year_start year_finish campus city state pop off_camp pop_adjusted
2020 2021 University of Central Florida Orlando Florida 70406 0.85 59845.10
2020 2021 Texas A&M University College Station Texas 73284 0.80 58627.20
2020 2021 Florida International University Miami Florida 56627 0.95 53795.65
2020 2021 Ohio State University Columbus Ohio 67772 0.76 51506.72
2020 2021 University of Florida Gainesville Florida 60613 0.84 50914.92
2020 2021 University of Texas at Austin Austin Texas 51992 0.92 47832.64
2020 2021 University of Minnesota Minneapolis/Saint Paul Minnesota 52376 0.87 45567.12
2020 2021 Georgia State University Atlanta Georgia 52530 0.85 44650.50
2020 2021 Arizona State University Tempe Arizona 54000 0.81 43740.00
2020 2021 University of Illinois at Urbana–Champaign Urbana/Champaign Illinois 56299 0.50 28149.50
2019 2020 University of Central Florida Orlando Florida 71948 0.85 61155.80
2019 2020 Texas A&M University College Station Texas 71109 0.80 56887.20
2019 2020 Florida International University Miami Florida 58928 0.95 55981.60
2019 2020 University of Florida Gainesville Florida 57841 0.84 48586.44
2019 2020 University of Texas at Austin Austin Texas 51832 0.92 47685.44

Here is a look at the mean of the adjusted populations for each university since 2009. The schools which are consistently in the Top Ten Most Populous Universities in the country are highlighted in yellow.

campus mean_pop
University of Central Florida 53843.68
Florida International University 51281.26
Texas A&M University 47518.87
University of Texas at Austin 47349.22
Michigan State University 45913.49
University of South Florida 45893.40
Ohio State University 45174.15
University of Minnesota 44928.68
Georgia State University 44829.00
Arizona State University 44711.19
University of Florida 44640.12
Indiana University 35289.66
Pennsylvania State University 33059.87
Indiana University Bloomington 30913.31
University of Illinois at Urbana–Champaign 26637.67

If I am going to find a rental property, these seem like a pretty good place to start looking! These universities consistently have the greatest amount of students looking for a place to live off-campus.

Finding the Property

Finding the ideal property was no easy task. Although the web seems to be filled with an enormous amount of real estate data, most of this data is either kept private or is untrustworthy. In order to get my hands on the data I needed, I had to write some code that could scrape one of the most popular real estate websites: realtor.com.
Note: I made sure to check www.realtor.com/robots.txt to ensure that I wasn’t scraping pages that are forbiden

Here’s a look at the for-loop I created to find the metrics I was looking for:

library(tidyverse)
library(rvest)

cities <- c("College-Station_TX", "Orlando_FL", "Miami_FL", "Columbus_OH", 
            "Gainesville_FL", "Austin_TX", "Minneapolis_MN", "Atlanta_GA",
            "Tempe_AZ", "Champaign_IL", "Tampa_FL", "East-Lansing_MI",
            "University-Park_IL", "Bloomington_IN")

df1 = data.frame()

for (city in cities) {
  city_page = paste0("https://www.realtor.com/realestateandhomes-search/", city, "/beds-1/sqft-500/pg-")
  
  for (page_result in 1:8) {
    
    link = paste0(city_page, page_result, "")
    Sys.sleep(time = 10)
    page = read_html(link)
    
    address = page %>% html_nodes(".srp-address-redesign") %>% html_text()
    price = page %>% html_nodes(".srp-page-price > .bowEcH") %>% html_text()
    beds = page %>% html_nodes(".srp_list:nth-child(1)") %>% html_text()
    baths = page %>% html_nodes(".srp_list:nth-child(2)") %>% html_text()
    sq_ft = page %>% html_nodes(".srp_list:nth-child(3)") %>% html_text()
    location = rep(city, length(address))
    
    df1 = rbind(df1, data.frame(address, price, beds, baths, sq_ft, location,
                                stringsAsFactors = FALSE))
    
    print(paste("Page:", page_result))
    
    Sys.sleep(time = 5)
  }
  
  Sys.sleep(time=20)
  
  
}

write_csv(df1, file = "./../data/realtor.csv")

The beautiful thing about this code is that, with permission from Realtor.com, I will always have access to the most updated real estate listings from these fourteen cities in one neat and concise data frame. What would normally take hours of shuffling through page after page of search results, and manually imputing data into an excel spreadsheet, now takes minutes. Those few lines of code allow me to access thousands of up-to-date real estate listings in an easy-to-read format that I can manipulate to find the results I am looking for.
Here’s what it looks like:

address price beds baths sq_ft city
1 E Main St Ste 409, Champaign, IL 61820 210000 2 1.5 1185 Champaign
1 W Lake St Apt 309, Minneapolis, MN 55408 135000 1 1.0 735 Minneapolis
100 3rd Ave S Unit 605, Minneapolis, MN 55401 565000 2 2.0 1546 Minneapolis
100 S Eola Dr Unit 1113, Orlando, FL 32801 635000 2 2.5 1885 Orlando
100 S Eola Dr Unit 1211, Orlando, FL 32801 575000 2 2.5 2100 Orlando
1000 Brickell Plz Ph 6007, Miami, FL 33131 2715000 3 3.5 1912 Miami
1000 Brickell Plz Unit 3502, Miami, FL 33131 2050000 3 3.5 1909 Miami
1000 Spring Loop Apt 1306, College Station, TX 77840 174500 2 2.5 1168 College_Station
1000 W Horatio St Apt 207, Tampa, FL 33606 239999 1 1.0 631 Tampa
10000 SW 52nd Ave Unit V137, Gainesville, FL 32608 169900 1 1.0 965 Gainesville

When I first set out on this project, I wanted to compare home prices with the average price of rent for one bedroom in each city. This way I could estimate how much I would cash-flow from each property every month. Unfortunately, it wasn’t long before I realized that the average price of rent for any size home would be an extremely difficult number to estimate, if at all truly possible. So, instead, I had to rely on the metrics that I already had.
I knew that the most profitable home would be the one with the most rooms to rent out and the smallest monthly payment. In other words, I wanted to find which properties would offered me the most rooms at the lowest price. So, I create a new column on my data frame where I divided the price of every home by the number of rooms it has. It is listed here as “return”: Note: I decided to filter out all the homes with less than 3 rooms and less than 2 bathrooms.

address price beds baths sq_ft city return
3110 W Vernal Pike, Bloomington, IN 47404 1 3 2 1110 Bloomington 0.33
5611 E State Road 45 Hwy, Bloomington, IN 47408 1 3 2 1584 Bloomington 0.33
2727 E University Dr Lot 41, Tempe, AZ 85281 34500 3 2 1248 Tempe 11500.00
16430 Park Lake Rd Lot 72, East Lansing, MI 48823 48995 3 2 1216 East_Lansing 16331.67
1006 Windmill Grove Cir, Orlando, FL 32828 50000 3 2 1568 Orlando 16666.67
611 W Bradley Ave, Champaign, IL 61820 109900 6 2 1711 Champaign 18316.67
917 W Beardsley Ave, Champaign, IL 61821 92000 5 2 1728 Champaign 18400.00
1601 E Slaughter Ln Trlr 488, Austin, TX 78747 58995 3 2 1216 Austin 19665.00
1203 W Bradley Ave, Champaign, IL 61821 79900 4 2 1272 Champaign 19975.00
307 W Columbia Ave, Champaign, IL 61820 139900 7 2 2500 Champaign 19985.71


You’re telling me there are properties listed for $1?? You bet I’m checking this out!



Hmmm… I don’t know how appealing this will be to potential tenants… better keep looking!
That 6 bed home in Champaign looks interesting… better take a look!



Ta Da!

Now that’s more like it! It looks like this home has been on the market for a few months, but the owners are now facing foreclosure and recently dropped the price to what it is. The home has 6 bedrooms, 2 bathrooms, as well as two kitchens, a two-car garage, a new roof, and some new renovations! Plus, it’s only a 9 minute drive to the University of Illinois at Urbana–Champaign! After 12 months of renting out each room at $400 a room, I would be bringing in an estimated $1,777 a month (assuming a 20% down payment and a 30-year-loan with a fixed interest rate of 3.16%), while acquiring equity in the property. I think this is the deal I am looking for!

One more thought

What about that list of eight schools that consistently made the Top 10 Most Populous Schools over the last 12 years? University of Illinois wasn’t on it. Maybe I should narrow the list of properties to only those near these schools.

address price beds baths sq_ft city return
2727 E University Dr Lot 41, Tempe, AZ 85281 34500 3 2 1248 Tempe 11500.00
1006 Windmill Grove Cir, Orlando, FL 32828 50000 3 2 1568 Orlando 16666.67
1601 E Slaughter Ln Trlr 488, Austin, TX 78747 58995 3 2 1216 Austin 19665.00
2424 Phipps Ave, Orlando, FL 32818 60000 3 2 1440 Orlando 20000.00
13021 Dessau Rd Lot 726, Austin, TX 78754 71995 3 2 1216 Austin 23998.33
2340 E University Dr Lot 90, Tempe, AZ 85281 75000 3 2 900 Tempe 25000.00
13021 Dessau Rd Lot 193, Austin, TX 78754 85995 3 2 1456 Austin 28665.00
13021 Dessau Rd Lot 229, Austin, TX 78754 85995 3 2 1456 Austin 28665.00
2154 Minnesota Ave, Columbus, OH 43211 89000 3 2 1195 Columbus 29666.67
6519 W Newberry Rd Apt 1015, Gainesville, FL 32605 89000 3 2 1289 Gainesville 29666.67

All of these properties look like they need some additional work, I’ll keep looking down the list for something a little more… up-to-code…
Found one!

## # A tibble: 1 × 7
##   address                              price  beds baths sq_ft city       return
##   <chr>                                <dbl> <dbl> <dbl> <dbl> <chr>       <dbl>
## 1 521 Southwest Pkwy Apt 101, Colleg… 135000     4     4  1236 College_S…  33750

Here’s the corresponding page on Realtor.com:

This condo is listed at /$135,000. It includes 4 beds (each with its own private bathroom), a pool, a volleyball court, and is within walking distance to Texas A&M! Sounds like an easy pitch to an Aggie! At $500 a room, this property would cash-flow $988 month while generating equity over-time. And with the Texas A & M undergraduate population growing the way it has been, there will always be students looking for a sweet place to live near campus.

Wrapping it up

This project was tough, but the results of it are incredibly useful. Even if I decide to wait before investing into real estate, as long as I have access to this code, I can come back years from now and, with the push of a button, have the most up-to-date real estate listings from these areas. I have come to appreciate how powerful the Rvest package can be! With a few tweaks, this whole system could become totally automated to the point where any city could be scraped from a number of websites (imagine doing this with the MLS!). Now, its time to make me some money…